package cn.regex.mp.mapper;

import cn.regex.mp.domain.Employee;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface EmployeeMapper extends BaseMapper<Employee> {
    @Select("select * from employee")
    List<Employee> listByXmlSingle();
    @Select("select e.id, e.name, e.password, e.email, e.age, e.admin, d.id d_id, d.name d_name, d.sn d_sn " +
            "from employee e left join department d " +
            "on e.dept_id = d.id")
    @Results({
            @Result(column="d_id", property = "dept.id"),
            @Result(column="d_name", property = "dept.name"),
            @Result(column="d_sn", property = "dept.sn")
    })
    List<Employee> listByXmlJoin();
}
